package com.ewzj.bigdata.mvp.ui.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewzj.bigdata.R;
import com.ewzj.bigdata.mvp.model.rspbean.SubFilterBean;

import java.util.List;

/**
 * author:zhangjing
 * 作用:
 * return:
 */

public class MoreItemTagAdapter extends BaseQuickAdapter<SubFilterBean.DataEntity.ChildrenEntity,BaseViewHolder> {
    public MoreItemTagAdapter(List<SubFilterBean.DataEntity.ChildrenEntity> data) {
        super(R.layout.item_more_tag, data);
    }

    @Override
    protected void convert(final BaseViewHolder baseViewHolder, final SubFilterBean.DataEntity.ChildrenEntity childrenEntity) {
        baseViewHolder.setText(R.id.tv_tag,childrenEntity.getName());
        baseViewHolder.getView(R.id.tv_tag).setSelected(childrenEntity.isseld());
        baseViewHolder.getConvertView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (childrenEntity.isseld()){
                    childrenEntity.setIsseld(false);
                }else {
                    childrenEntity.setIsseld(true);
                }
                notifyItemChanged(baseViewHolder.getLayoutPosition());
            }
        });
    }
}
